<!DOCTYPE html>
<html lang="zh">
<head>
  <title></title>
  <meta charset="UTF-8">
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <meta name="renderer" content="webkit">
  <meta name="force-rendering" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <meta content="email=no" name="format-detection" />
  <meta name="format-detection" content="telephone=no">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  <link rel="stylesheet" href="/guanyuanmobile/css/swiper.min.css">
  <link rel="stylesheet" href="/guanyuanmobile/css/index.css">
  <script>window.mobileUtils=function(e,t){var i=navigator.userAgent,n=/android|adr/gi.test(i),a=/iphone|ipod|ipad/gi.test(i)&&!n;return{isAndroid:n,isIos:a,isMobile:n||a,isWeixin:/MicroMessenger/gi.test(i),isQQ:/QQ\/\d/gi.test(i),dpr:a?Math.min(e.devicePixelRatio,3):1,rem:null,fixScreen:function(){var i=this,n=t.querySelector('meta[name="viewport"]'),r=n?n.content:"";if(r.match(/initial\-scale=([\d\.]+)/),r.match(/width=([^,\s]+)/),!n){var o,s=t.documentElement,d=s.dataset.mw||750,m=a?Math.min(e.devicePixelRatio,3):1;t.getElementsByTagName("body")[0],s.removeAttribute("data-mw"),s.dataset.dpr=m,n=t.createElement("meta"),n.name="viewport",n.content=function(e){return"viewport-fit=cover,initial-scale="+e+",maximum-scale="+e+",minimum-scale="+e}(1),s.firstElementChild.appendChild(n);var c=function(){var e=s.getBoundingClientRect().width;e=e>d?d:e;var t=e/16;i.rem=t,s.style.fontSize=t+"px"};e.addEventListener("resize",function(){clearTimeout(o),o=setTimeout(c,300)},!1),e.addEventListener("pageshow",function(e){e.persisted&&(clearTimeout(o),o=setTimeout(c,300))},!1),c()}}}}(window,document),mobileUtils.fixScreen();</script>

 <style type="text/css">
   .layui-m-layercont {
     padding: 1px 1px;
     line-height: 22px;
     text-align: center;
   }

 </style>
</head>
<body style='background:#fff'>
<!-- 头部 -->
<div class="container">
  <div class="header clearfix">
    <div class="logo"></div>
    <div class="l1">正言  正身  正人  正心</div>
    <div class="logo2"></div>
    <div class="backIcon" onclick="javascript:history.back(-1);">返回</div>
  </div>
  <div class="img1"></div><a style="color:#c69952;font-size: 16px;margin-top:5px;margin-right:5px;float:right" onclick="showLy()">查看留言</a>
  <div class="editBox" style="display: none" id="editBox">

    <textarea class="editTxt" id="content" placeholder="内容："></textarea>
    <div class="editCon">
      <div class="p1">
        <span>联系人：</span>
        <input type="text" id="name" name="name">
      </div>
      <div class="p1">
        <span>电　话：</span>
        <input type="tel"id="phone" name="phone">
      </div>
      <p class="p2">请注明是手机、电话、QQ、Email,方便我们和您联系</p>
      <p class="p2" style="color: red" id="errorMsg"></p>
      <div class="subBtn" onclick="saveCtmsg();">提 交</div>
    </div>
  </div>
  <div class="beforeEdit" id="beforeEdit">
    <p class="pCenter"><img class="xl" src="/guanyuanmobile/images/xl.gif"></p>
    <!-- <div class="xlP">
      点击香炉 敬香留言
      <span class="spL"></span>
      <span class="spR"></span>
    </div> -->
  </div>
</div>
<div id="thtmlId" style="display: none;">

  <iframe frameborder="no"  height="500px" width="100%" border="0" marginwidth="0" marginheight="0" scrolling="auto" allowtransparency="yes"  src="/mobile/infinite"></iframe>

</div>
<script src='/guanyuanmobile/js/lib/jquery-1.10.1.min.js'></script>
<script src="/guanyuanmobile/js/lib/swiper-3.4.2.min.js"></script>
<script src="/plugins/layer/layer.js"></script>
<script type="text/javascript">

    var gPwd = "0";
    $('.beforeEdit').on('click', function(){
      var lyaindex = layer.prompt({title:'请输入密码',formType : 1},function (value,index) {
        $.ajax({
          type: "POST",
          url: "/mobile/pwdv",
          data: {"pwd":value},
          dataType: "json",
          success: function (ret) {
            var status = ret.code;
            if(status===0){
              $(this).hide();
              $('#editBox').show();
            }else{
              alert("密码错误");
            }
            layer.close(lyaindex);
          }
        });
      });
    });



    function saveCtmsg(){
        $("#errorMsg").hide();
        var name = $("#name").val();
        var phone = $("#phone").val();
        var content = $("#content").val();

        var flag = 0;
        if(!content){
            flag=1;
            showerrorMsg("请输入内容");
            return;
        }
        if(!name){
            flag=1;
            showerrorMsg("请填写联系人");
            return;
        }
        if(!phone){
            flag=1;
            showerrorMsg("请填写联系方式");
            return;
        }
        if(flag==0){
            //$.showLoading("正在提留言交数据...");
            $.ajax({
                type: "POST",
                url: "/mobile/ctsubmit",
                data: {"name":name,"content":content,"phone":phone},
                dataType: "json",
                success: function (data) {

                    $("#name").val("");
                    $("#phone").val("");
                    $("#content").val("");

                    showerrorMsg("提交成功！");
                    setTimeout(function(){
                        $("#errorMsg").hide();
                    },3000);
                }
            });
        }
    }

    function showerrorMsg(textMsg){
        $("#errorMsg").show();
        $("#errorMsg").text(textMsg);
    }


    function  showLy() {
        var url = "/mobile/infinite";
        var thtml = $("#thtmlId").html();
        window.layerObj = layer.open({
            type: 0
            ,content: thtml
            ,anim: 'up'
            ,style: 'position:fixed; bottom:0; left:0; width: 100%; height: 500px;'
        });


        $(".layui-m-layercont").removeClass();

    }

    function fff(){

        layer.close(window.layerObj);
    }

</script>
</body>
</html>
